#include <stdio.h>
#include <stdbool.h>
#include <ctype.h>

int is_num(char ch)
{
	if (ch >= '0' && ch <= '9')
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

bool isPalindrome(char* s)
{
	int num = strlen(s);
	int left = 0;
	int right = num - 1;

	while (left <= right)
	{
		while (!islower(s[left]) && !isupper(s[left]) && !is_num(s[left]))
		{

			left++;

			if (left > right)
			{
				return true;
			}
		}
		while (!islower(s[right]) && !isupper(s[right]) && !is_num(s[right]))
		{
			right--;
			if (left > right)
			{
				return true;
			}
		}

		if (isupper(s[left]))
		{
			s[left] = tolower(s[left]);
		}
		if (isupper(s[right]))
		{
			s[right] = tolower(s[right]);
		}

		if (s[left] == s[right])
		{
			left++;
			right--;
		}
		else
		{
			return false;
		}
	}
	return true;
}

int main()
{
	char arr[] = "ab2a";
	if (isPalindrome(arr))
	{
		printf("true");
	}
	else
	{
		printf("false");
	}

	return 0;
}